package com.yangjun.common.timetask;

import java.io.IOException;

import org.codehaus.jackson.JsonGenerationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.fasterxml.jackson.databind.JsonMappingException;
import com.yangjun.entity.businessAnalysis.logisticsAnalysis.OverviewFormEntity;
import com.yangjun.service.bussiness.PackageEfficacyExportService;
import com.yangjun.utils.JSONUtils;
import com.yangjun.utils.RedisClientLocalUtils;


@Component
public class ScheduledMemcachePackageEfficacyTask {
	
	
	
	@Autowired
	PackageEfficacyExportService service;
	
	
	private static RedisClientLocalUtils rc = new RedisClientLocalUtils();
	
//	@Scheduled(cron = "0 */5 * * * *")
    public void overviewForm() {
		System.err.println("overviewForm缓存");
    	
    	OverviewFormEntity overviewForm = null;
    	String[] ordersourceArr = {"-1","1","2","3","4","5","6","7","8","10","11","12","13","14","15","16","17","18","19","20","21","23","24","25","26","27","28","30","40","41","42","48","49","50","101","999"};
    	String[] urgenttype={"-1","0","1"};
    	try {
    		
    		for(String plate : ordersourceArr){
    			for(String urgen:urgenttype){
    				overviewForm = service.getOverviewForm(plate,urgen);
    	    		rc.setKeyValue("overview_"+plate+"_"+urgen+"", JSONUtils.objToStr(overviewForm));

    			}
    		}
		} catch (JsonGenerationException e) {
			e.printStackTrace();
		} catch (JsonMappingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}

}
